/* i18n.js */
const translations = {
  en: {
    "please_log_in_to_continue": "Please log in to continue.",
    "no_files_selected": "No files selected.",
    "confirm_delete_files": "Are you sure you want to delete {count} selected file(s)?",
    "element_not_found": "Element with id \"{id}\" not found.",
    "search_placeholder": "Search files, tags, & uploader...",
    "search_placeholder_advanced": "Advanced Search: files, tags, uploader & content...",
    "basic_search_tooltip": "Basic Search: Search by file name, tags, and uploader.",
    "advanced_search_tooltip": "Advanced Search: Includes file content, in addition to file name, tags, and uploader.",
    "file_name": "File Name",
    "date_modified": "Date Modified",
    "upload_date": "Upload Date",
    "file_size": "File Size",
    "uploader": "Uploader",
    "enter_totp_code": "Enter TOTP Code",
    "use_recovery_code_instead": "Use Recovery Code instead",
    "enter_recovery_code": "Enter Recovery Code",
    "editing": "Editing",
    "decrease_font": "A-",
    "increase_font": "A+",
    "save": "Save",
    "close": "Close",
    "no_files_found": "No files found.",
    "switch_to_table_view": "Switch to Table View",
    "switch_to_gallery_view": "Switch to Gallery View",
    "share_file": "Share File",
    "set_expiration": "Set Expiration:",
    "password_optional": "Password (optional):",
    "generate_share_link": "Generate Share Link",
    "shareable_link": "Shareable Link:",
    "copy_link": "Copy Link",
    "tag_file": "Tag File",
    "tag_name": "Tag Name:",
    "tag_color": "Tag Color:",
    "save_tag": "Save Tag",
    "light_mode": "Light Mode",
    "dark_mode": "Dark Mode",
    "upload_instruction": "Drop files/folders here or click 'Choose files'",
    "no_files_selected_default": "No files selected",
    "choose_files": "Choose files",
    "delete_selected": "Delete Selected",
    "copy_selected": "Copy Selected",
    "move_selected": "Move Selected",
    "tag_selected": "Tag Selected",
    "download_zip": "Download Zip",
    "extract_zip": "Extract Zip",
    "preview": "Preview",
    "edit": "Edit",
    "rename": "Rename",
    "trash_empty": "Trash is empty.",
    "no_trash_selected": "No trash items selected for restore.",

    // Additional keys for HTML translations:
    "title": "FileRise",
    "header_title": "FileRise",
    "header_title_text": "Header Title",
    "logout": "Logout",
    "change_password": "Change Password",
    "restore_text": "Restore or",
    "delete_text": "Delete Trash Items",
    "restore_selected": "Restore Selected",
    "restore_all": "Restore All",
    "delete_selected_trash": "Delete Selected",
    "delete_all": "Delete All",
    "upload_header": "Upload Files/Folders",

    // Folder Management keys:
    "folder_navigation": "Folder Navigation & Management",
    "create_folder": "Create Folder",
    "create_folder_title": "Create Folder",
    "enter_folder_name": "Enter folder name",
    "cancel": "Cancel",
    "create": "Create",
    "rename_folder": "Rename Folder",
    "rename_folder_title": "Rename Folder",
    "rename_folder_placeholder": "Enter new folder name",
    "delete_folder": "Delete Folder",
    "delete_folder_title": "Delete Folder",
    "delete_folder_message": "Are you sure you want to delete this folder?",
    "folder_help": "Folder Help",
    "folder_help_item_1": "Click on a folder in the tree to view its files.",
    "folder_help_item_2": "Use [-] to collapse and [+] to expand folders.",
    "folder_help_item_3": "Select a folder and click \"Create Folder\" to add a subfolder.",
    "folder_help_item_4": "To rename or delete a folder, select it and then click the appropriate button.",

    // File List keys:
    "actions": "Actions",
    "file_list_title": "Files in (Root)",
    "files_in": "Files in",
    "delete_files": "Delete Files",
    "delete_selected_files_title": "Delete Selected Files",
    "delete_files_message": "Are you sure you want to delete the selected files?",
    "copy_files": "Copy Files",
    "copy_files_title": "Copy Selected Files",
    "copy_files_message": "Select a target folder for copying the selected files:",
    "move_files": "Move Files",
    "move_files_title": "Move Selected Files",
    "move_files_message": "Select a target folder for moving the selected files:",
    "move": "Move",
    "extract_zip_button": "Extract Zip",
    "download_zip_title": "Download Selected Files as Zip",
    "download_zip_prompt": "Enter a name for the zip file:",
    "zip_placeholder": "files.zip",
    "share": "Share",
    "total_files": "Total Files",
    "total_size": "Total Size",
    "prev": "Prev",
    "next": "Next",
    "page": "Page",
    "of": "of",

    // Login Form keys:
    "login": "Login",
    "remember_me": "Remember me",
    "login_oidc": "Login with OIDC",
    "basic_http_login": "Use Basic HTTP Login",

    // Change Password keys:
    "change_password_title": "Change Password",
    "old_password": "Old Password",
    "new_password": "New Password",
    "confirm_new_password": "Confirm New Password",

    // Add User keys:
    "create_new_user_title": "Create New User",
    "username": "Username:",
    "password": "Password:",
    "enter_password": "Password",
    "preparing_download": "Preparing your download...",
    "download_file": "Download File",
    "confirm_or_change_filename": "Confirm or change the download file name:",
    "filename": "Filename",
    "cancel": "Cancel",
    "download": "Download",
    "grant_admin": "Grant Admin Access",
    "save_user": "Save User",

    // Remove User keys:
    "remove_user_title": "Remove User",
    "select_user_remove": "Select a user to remove:",
    "delete_user": "Delete User",

    // Rename File keys:
    "rename_file_title": "Rename File",
    "rename_file_placeholder": "Enter new file name",

    // Folder Share
    "share_folder": "Share Folder",
    "allow_uploads": "Allow Uploads",
    "share_link_generated": "Share Link Generated",
    "error_generating_share_link": "Error Generating Share Link",
    "custom": "Custom",
    "duration": "Duration",
    "seconds": "Seconds",
    "minutes": "Minutes",
    "hours": "Hours",
    "days": "Days",
    "custom_duration_warning": "⚠️ Using a long expiration may pose security risks. Use with caution.",

    // Folder
    "folder_share": "Share Folder",

    // Custom Confirm Modal keys:
    "yes": "Yes",
    "no": "No",
    "unsaved_changes_confirm": "You have unsaved changes. Are you sure you want to close without saving?",
    "delete": "Delete",
    "download": "Download",
    "upload": "Upload",
    "copy": "Copy",
    "extract": "Extract",
    "user": "User:",
    "unknown_error": "Unknown Error",
    "link_copied": "Link Copied to Clipboard",
    "weeks": "weeks",
    "months": "months",

    // Dark Mode Toggle
    "dark_mode_toggle": "Dark Mode",
    "light_mode_toggle": "Light Mode",
    "switch_to_light_mode": "Switch to light mode",
    "switch_to_dark_mode": "Switch to dark mode",

    // Admin Panel
    "header_settings": "Header Settings",
    "shared_max_upload_size_bytes_title": "Shared Max Upload Size",
    "shared_max_upload_size_bytes": "Shared Max Upload Size (bytes)",
    "max_bytes_shared_uploads_note": "Enter maximum bytes allowed for shared-folder uploads",
    "manage_shared_links": "Manage Shared Links",
    "folder_shares": "Folder Shares",
    "file_shares": "File Shares",
    "loading": "Loading…",
    "error_loading_share_links": "Error loading share links",
    "share_deleted_successfully": "Share deleted successfully",
    "error_deleting_share": "Error deleting share",
    "password_protected": "Password protected",
    "no_shared_links_available": "No shared links available",


    // NEW KEYS ADDED FOR ADMIN, USER PANELS, AND TOTP MODALS:
    "admin_panel": "Admin Panel",
    "user_panel": "User Panel",
    "user_settings": "User Settings",
    "save_profile_picture": "Save Profile Picture",
    "please_select_picture": "Please select a picture",
    "profile_picture_updated": "Profile picture updated",
    "error_updating_picture": "Error updating profile picture",
    "trash_restore_delete": "Trash Restore/Delete",
    "totp_settings": "TOTP Settings",
    "enable_totp": "Enable TOTP",
    "language": "Language",
    "select_language": "Select Language",
    "english": "English",
    "spanish": "Spanish",
    "french": "French",
    "german": "German",
    "use_totp_code_instead": "Use TOTP Code instead",
    "submit_recovery_code": "Submit Recovery Code",
    "please_enter_recovery_code": "Please enter your recovery code.",
    "recovery_code_verification_failed": "Recovery code verification failed",
    "error_verifying_recovery_code": "Error verifying recovery code",
    "totp_verification_failed": "TOTP verification failed",
    "error_verifying_totp_code": "Error verifying TOTP code",
    "totp_setup": "TOTP Setup",
    "scan_qr_code": "Scan this QR code with your authenticator app.",
    "enter_totp_confirmation": "Enter the 6-digit code from your app to confirm setup:",
    "confirm": "Confirm",
    "please_enter_valid_code": "Please enter a valid 6-digit code.",
    "totp_enabled_successfully": "TOTP successfully enabled.",
    "error_generating_recovery_code": "Error generating recovery code",
    "error_loading_qr_code": "Error loading QR code.",
    "error_disabling_totp_setting": "Error disabling TOTP setting",
    "user_management": "User Management",
    "add_user": "Add User",
    "remove_user": "Remove User",
    "user_permissions": "User Permissions",
    "oidc_configuration": "OIDC Configuration",
    "oidc_provider_url": "OIDC Provider URL",
    "oidc_client_id": "OIDC Client ID",
    "oidc_client_secret": "OIDC Client Secret",
    "oidc_redirect_uri": "OIDC Redirect URI",
    "global_totp_settings": "Global TOTP Settings",
    "global_otpauth_url": "Global OTPAuth URL",
    "login_options": "Login Options",
    "disable_login_form": "Disable Login Form",
    "disable_basic_http_auth": "Disable Basic HTTP Auth",
    "disable_oidc_login": "Disable OIDC Login",
    "save_settings": "Save Settings",
    "at_least_one_login_method": "At least one login method must remain enabled.",
    "settings_updated_successfully": "Settings updated successfully.",
    "error_updating_settings": "Error updating settings",
    "user_permissions_updated_successfully": "User permissions updated successfully.",
    "error_updating_permissions": "Error updating permissions",
    "no_users_found": "No users found.",
    "user_folder_only": "User Folder Only",
    "read_only": "Read Only",
    "disable_upload": "Disable Upload",
    "error_loading_users": "Error loading users",
    "save_permissions": "Save Permissions",
    "your_recovery_code": "Your Recovery Code",
    "please_save_recovery_code": "Please save this code securely. It will not be shown again and can only be used once.",
    "ok": "OK",
    "show": "Show",
    "items_per_page": "items per page",
    "columns": "Columns",
    "row_height": "Row Height",
    "api_docs": "API Docs",
    "show_folders_above_files": "Show folders above files",
    "display": "Display",
    "create_file": "Create File",
    "create_new_file": "Create New File",
    "enter_file_name": "Enter file name",
    "newfile_placeholder": "New file name",
    "file_created_successfully": "File created successfully!",
    "error_creating_file": "Error creating file",
    "file_created":          "File created successfully!"
  },
  es: {
    "please_log_in_to_continue": "Por favor, inicie sesión para continuar.",
    "no_files_selected": "No se han seleccionado archivos.",
    "confirm_delete_files": "¿Está seguro de que desea eliminar {count} archivo(s) seleccionado(s)?",
    "element_not_found": "Elemento con id \"{id}\" no encontrado.",
    "search_placeholder": "Buscar archivos, etiquetas y cargador...",
    "search_placeholder_advanced": "Búsqueda avanzada: archivos, etiquetas, cargador y contenido...",
    "basic_search_tooltip": "Búsqueda básica: Buscar por nombre de archivo, etiquetas y cargador.",
    "advanced_search_tooltip": "Búsqueda avanzada: Incluye el contenido del archivo, además del nombre, etiquetas y cargador.",
    "file_name": "Nombre del archivo",
    "date_modified": "Fecha de modificación",
    "upload_date": "Fecha de carga",
    "file_size": "Tamaño del archivo",
    "uploader": "Cargado por",
    "enter_totp_code": "Ingrese el código TOTP",
    "use_recovery_code_instead": "Usar código de recuperación en su lugar",
    "enter_recovery_code": "Ingrese el código de recuperación",
    "editing": "Editando",
    "decrease_font": "A-",
    "increase_font": "A+",
    "save": "Guardar",
    "close": "Cerrar",
    "no_files_found": "No se encontraron archivos.",
    "switch_to_table_view": "Cambiar a vista de tabla",
    "switch_to_gallery_view": "Cambiar a vista de galería",
    "share_file": "Compartir archivo",
    "set_expiration": "Establecer vencimiento:",
    "password_optional": "Contraseña (opcional):",
    "generate_share_link": "Generar enlace para compartir",
    "shareable_link": "Enlace para compartir:",
    "copy_link": "Copiar enlace",
    "tag_file": "Etiquetar archivo",
    "tag_name": "Nombre de la etiqueta:",
    "tag_color": "Color de la etiqueta:",
    "save_tag": "Guardar etiqueta",
    "light_mode": "Modo claro",
    "dark_mode": "Modo oscuro",
    "upload_instruction": "Suelte archivos/carpetas aquí o haga clic en 'Elegir archivos'",
    "no_files_selected_default": "No se han seleccionado archivos",
    "choose_files": "Elegir archivos",
    "delete_selected": "Eliminar seleccionados",
    "copy_selected": "Copiar seleccionados",
    "move_selected": "Mover seleccionados",
    "tag_selected": "Etiquetar seleccionados",
    "download_zip": "Descargar Zip",
    "extract_zip": "Extraer Zip",
    "preview": "Vista previa",
    "edit": "Editar",
    "rename": "Renombrar",
    "trash_empty": "La papelera está vacía.",
    "no_trash_selected": "No se han seleccionado elementos de la papelera para restaurar.",

    // Additional keys for HTML translations:
    "title": "FileRise",
    "header_title": "FileRise",
    "header_title_text": "Header Title",
    "logout": "Cerrar sesión",
    "change_password": "Cambiar contraseña",
    "restore_text": "Restaurar o",
    "delete_text": "Eliminar elementos de la papelera",
    "restore_selected": "Restaurar seleccionados",
    "restore_all": "Restaurar todo",
    "delete_selected_trash": "Eliminar seleccionados",
    "delete_all": "Eliminar todo",
    "upload_header": "Cargar archivos/carpetas",

    // Folder Management keys:
    "folder_navigation": "Navegación y gestión de carpetas",
    "create_folder": "Crear carpeta",
    "create_folder_title": "Crear carpeta",
    "enter_folder_name": "Ingrese el nombre de la carpeta",
    "cancel": "Cancelar",
    "create": "Crear",
    "rename_folder": "Renombrar carpeta",
    "rename_folder_title": "Renombrar carpeta",
    "rename_folder_placeholder": "Ingrese el nuevo nombre de la carpeta",
    "delete_folder": "Eliminar carpeta",
    "delete_folder_title": "Eliminar carpeta",
    "delete_folder_message": "¿Está seguro de que desea eliminar esta carpeta?",
    "folder_help": "Ayuda de carpetas",
    "folder_help_item_1": "Haga clic en una carpeta en el árbol para ver sus archivos.",
    "folder_help_item_2": "Utilice [-] para contraer y [+] para expandir las carpetas.",
    "folder_help_item_3": "Seleccione una carpeta y haga clic en \"Crear carpeta\" para agregar una subcarpeta.",
    "folder_help_item_4": "Para renombrar o eliminar una carpeta, selecciónela y luego haga clic en el botón correspondiente.",

    // File List keys:
    "file_list_title": "Archivos en (Raíz)",
    "files_in": "Archivos en",
    "delete_files": "Eliminar archivos",
    "delete_selected_files_title": "Eliminar archivos seleccionados",
    "delete_files_message": "¿Está seguro de que desea eliminar los archivos seleccionados?",
    "copy_files": "Copiar archivos",
    "copy_files_title": "Copiar archivos seleccionados",
    "copy_files_message": "Seleccione una carpeta destino para copiar los archivos seleccionados:",
    "move_files": "Mover archivos",
    "move_files_title": "Mover archivos seleccionados",
    "move_files_message": "Seleccione una carpeta destino para mover los archivos seleccionados:",
    "move": "Mover",
    "extract_zip_button": "Extraer Zip",
    "download_zip_title": "Descargar archivos seleccionados en un Zip",
    "download_zip_prompt": "Ingrese un nombre para el archivo Zip:",
    "zip_placeholder": "files.zip",

    // Login Form keys:
    "login": "Iniciar sesión",
    "remember_me": "Recuérdame",
    "login_oidc": "Iniciar sesión con OIDC",
    "basic_http_login": "Usar autenticación HTTP básica",

    // Change Password keys:
    "change_password_title": "Cambiar contraseña",
    "old_password": "Contraseña antigua",
    "new_password": "Nueva contraseña",
    "confirm_new_password": "Confirmar nueva contraseña",

    // Add User keys:
    "create_new_user_title": "Crear nuevo usuario",
    "username": "Usuario:",
    "password": "Contraseña:",
    "enter_password": "Contraseña",
    "preparing_download": "Preparando su descarga...",
    "download_file": "Descargar Archivo",
    "confirm_or_change_filename": "Confirme o cambie el nombre del archivo a descargar:",
    "filename": "Nombre de archivo",
    "cancel": "Cancelar",
    "download": "Descargar",
    "grant_admin": "Otorgar acceso de administrador",
    "save_user": "Guardar usuario",

    // Remove User keys:
    "remove_user_title": "Eliminar usuario",
    "select_user_remove": "Seleccione un usuario para eliminar:",
    "delete_user": "Eliminar usuario",

    // Rename File keys:
    "rename_file_title": "Renombrar archivo",
    "rename_file_placeholder": "Ingrese el nuevo nombre del archivo",

    // Folder Share
    "share_folder": "Compartir carpeta",
    "allow_uploads": "Permitir cargas",
    "share_link_generated": "Enlace para compartir generado",
    "error_generating_share_link": "Error al generar el enlace para compartir",

    // Folder
    "folder_share": "Compartir carpeta",

    // Custom Confirm Modal keys:
    "yes": "Sí",
    "no": "No",
    "unsaved_changes_confirm": "Tiene cambios sin guardar. ¿Está seguro de que desea cerrar sin guardar?",
    "delete": "Eliminar",
    "download": "Descargar",
    "upload": "Cargar",
    "copy": "Copiar",
    "extract": "Extraer",
    "user": "Usuario:",
    "unknown_error": "Error desconocido",
    "link_copied": "Enlace copiado al portapapeles",
    "minutes": "minutos",
    "hours": "horas",
    "days": "días",
    "weeks": "semanas",
    "months": "meses",
    "seconds": "segundos",

    // Dark Mode Toggle
    "dark_mode_toggle": "Modo oscuro",
    "light_mode_toggle": "Modo claro",

    // NEW KEYS ADDED FOR ADMIN, USER PANELS, AND TOTP MODALS:
    "admin_panel": "Panel de Administración",
    "user_panel": "Panel de Usuario",
    "totp_settings": "Configuración TOTP",
    "enable_totp": "Activar TOTP",
    "language": "Idioma",
    "select_language": "Seleccionar idioma",
    "english": "Inglés",
    "spanish": "Español",
    "french": "Francés",
    "german": "Alemán",
    "use_totp_code_instead": "Usar código TOTP en su lugar",
    "submit_recovery_code": "Enviar código de recuperación",
    "please_enter_recovery_code": "Por favor, ingrese su código de recuperación.",
    "recovery_code_verification_failed": "La verificación del código de recuperación falló",
    "error_verifying_recovery_code": "Error al verificar el código de recuperación",
    "totp_verification_failed": "La verificación TOTP falló",
    "error_verifying_totp_code": "Error al verificar el código TOTP",
    "totp_setup": "Configuración TOTP",
    "scan_qr_code": "Escanee este código QR con su aplicación de autenticación.",
    "enter_totp_confirmation": "Ingrese el código de 6 dígitos de su aplicación para confirmar la configuración:",
    "confirm": "Confirmar",
    "please_enter_valid_code": "Por favor, ingrese un código válido de 6 dígitos.",
    "totp_enabled_successfully": "TOTP activado con éxito.",
    "error_generating_recovery_code": "Error al generar el código de recuperación",
    "error_loading_qr_code": "Error al cargar el código QR.",
    "error_disabling_totp_setting": "Error al desactivar la configuración TOTP",
    "user_management": "Gestión de Usuarios",
    "add_user": "Agregar usuario",
    "remove_user": "Eliminar usuario",
    "user_permissions": "Permisos de Usuario",
    "oidc_configuration": "Configuración OIDC",
    "oidc_provider_url": "URL del Proveedor OIDC",
    "oidc_client_id": "ID del Cliente OIDC",
    "oidc_client_secret": "Secreto del Cliente OIDC",
    "oidc_redirect_uri": "URI de Redirección OIDC",
    "global_totp_settings": "Configuración Global TOTP",
    "global_otpauth_url": "URL Global OTPAuth",
    "login_options": "Opciones de inicio de sesión",
    "disable_login_form": "Desactivar formulario de inicio de sesión",
    "disable_basic_http_auth": "Desactivar autenticación HTTP básica",
    "disable_oidc_login": "Desactivar inicio de sesión OIDC",
    "save_settings": "Guardar configuración",
    "at_least_one_login_method": "Al menos un método de inicio de sesión debe permanecer habilitado.",
    "settings_updated_successfully": "Configuración actualizada con éxito.",
    "error_updating_settings": "Error al actualizar la configuración",
    "user_permissions_updated_successfully": "Permisos de usuario actualizados con éxito.",
    "error_updating_permissions": "Error al actualizar los permisos",
    "no_users_found": "No se encontraron usuarios.",
    "user_folder_only": "Solo carpeta de usuario",
    "read_only": "Solo lectura",
    "disable_upload": "Desactivar carga",
    "error_loading_users": "Error al cargar usuarios",
    "save_permissions": "Guardar permisos",
    "your_recovery_code": "Su código de recuperación",
    "please_save_recovery_code": "Por favor, guarde este código de forma segura. No se mostrará de nuevo y solo podrá usarse una vez.",
    "ok": "OK",
    "columns": "Columnas"
  },
  fr: {
    "please_log_in_to_continue": "Veuillez vous connecter pour continuer.",
    "no_files_selected": "Aucun fichier sélectionné.",
    "confirm_delete_files": "Êtes-vous sûr de vouloir supprimer {count} fichier(s) sélectionné(s) ?",
    "element_not_found": "Élément avec l'id \"{id}\" non trouvé.",
    "search_placeholder": "Rechercher des fichiers, des balises et l'uploader...",
    "search_placeholder_advanced": "Recherche avancée : fichiers, balises, uploader et contenu...",
    "basic_search_tooltip": "Recherche basique : rechercher par nom de fichier, balises et uploader.",
    "advanced_search_tooltip": "Recherche avancée : inclut le contenu du fichier, en plus du nom, des balises et de l'uploader.",
    "file_name": "Nom du fichier",
    "date_modified": "Date de modification",
    "upload_date": "Date de téléchargement",
    "file_size": "Taille du fichier",
    "uploader": "Uploader",
    "enter_totp_code": "Entrez le code TOTP",
    "use_recovery_code_instead": "Utilisez le code de récupération à la place",
    "enter_recovery_code": "Entrez le code de récupération",
    "editing": "Modification",
    "decrease_font": "A-",
    "increase_font": "A+",
    "save": "Enregistrer",
    "close": "Fermer",
    "no_files_found": "Aucun fichier trouvé.",
    "switch_to_table_view": "Passer en vue tableau",
    "switch_to_gallery_view": "Passer en vue galerie",
    "share_file": "Partager le fichier",
    "set_expiration": "Définir l'expiration :",
    "password_optional": "Mot de passe (facultatif) :",
    "generate_share_link": "Générer le lien de partage",
    "shareable_link": "Lien partageable :",
    "copy_link": "Copier le lien",
    "tag_file": "Étiqueter le fichier",
    "tag_name": "Nom de l'étiquette :",
    "tag_color": "Couleur de l'étiquette :",
    "save_tag": "Enregistrer l'étiquette",
    "light_mode": "Mode clair",
    "dark_mode": "Mode sombre",
    "upload_instruction": "Déposez des fichiers/dossiers ici ou cliquez sur 'Choisir des fichiers'",
    "no_files_selected_default": "Aucun fichier sélectionné",
    "choose_files": "Choisir des fichiers",
    "delete_selected": "Supprimer la sélection",
    "copy_selected": "Copier la sélection",
    "move_selected": "Déplacer la sélection",
    "tag_selected": "Étiqueter la sélection",
    "download_zip": "Télécharger le Zip",
    "extract_zip": "Extraire le Zip",
    "preview": "Aperçu",
    "edit": "Modifier",
    "rename": "Renommer",
    "trash_empty": "La corbeille est vide.",
    "no_trash_selected": "Aucun élément de la corbeille sélectionné pour restauration.",

    // Additional keys for HTML translations:
    "title": "FileRise",
    "header_title": "FileRise",
    "logout": "Déconnexion",
    "change_password": "Changer le mot de passe",
    "restore_text": "Restaurer ou",
    "delete_text": "Supprimer les éléments de la corbeille",
    "restore_selected": "Restaurer la sélection",
    "restore_all": "Restaurer tout",
    "delete_selected_trash": "Supprimer la sélection",
    "delete_all": "Supprimer tout",
    "upload_header": "Téléverser des fichiers/dossiers",

    // Folder Management keys:
    "folder_navigation": "Navigation et gestion des dossiers",
    "create_folder": "Créer un dossier",
    "create_folder_title": "Créer un dossier",
    "enter_folder_name": "Entrez le nom du dossier",
    "cancel": "Annuler",
    "create": "Créer",
    "rename_folder": "Renommer le dossier",
    "rename_folder_title": "Renommer le dossier",
    "rename_folder_placeholder": "Entrez le nouveau nom du dossier",
    "delete_folder": "Supprimer le dossier",
    "delete_folder_title": "Supprimer le dossier",
    "delete_folder_message": "Êtes-vous sûr de vouloir supprimer ce dossier ?",
    "folder_help": "Aide des dossiers",
    "folder_help_item_1": "Cliquez sur un dossier dans l'arborescence pour voir ses fichiers.",
    "folder_help_item_2": "Utilisez [-] pour réduire et [+] pour développer les dossiers.",
    "folder_help_item_3": "Sélectionnez un dossier et cliquez sur \"Créer un dossier\" pour ajouter un sous-dossier.",
    "folder_help_item_4": "Pour renommer ou supprimer un dossier, sélectionnez-le puis cliquez sur le bouton approprié.",

    // File List keys:
    "file_list_title": "Fichiers dans (Racine)",
    "files_in": "Fichiers dans",
    "delete_files": "Supprimer les fichiers",
    "delete_selected_files_title": "Supprimer les fichiers sélectionnés",
    "delete_files_message": "Êtes-vous sûr de vouloir supprimer les fichiers sélectionnés ?",
    "copy_files": "Copier les fichiers",
    "copy_files_title": "Copier les fichiers sélectionnés",
    "copy_files_message": "Sélectionnez un dossier de destination pour copier les fichiers sélectionnés :",
    "move_files": "Déplacer les fichiers",
    "move_files_title": "Déplacer les fichiers sélectionnés",
    "move_files_message": "Sélectionnez un dossier de destination pour déplacer les fichiers sélectionnés :",
    "move": "Déplacer",
    "extract_zip_button": "Extraire le Zip",
    "download_zip_title": "Télécharger les fichiers sélectionnés en Zip",
    "download_zip_prompt": "Entrez un nom pour le fichier Zip :",
    "zip_placeholder": "files.zip",

    // Login Form keys:
    "login": "Connexion",
    "remember_me": "Se souvenir de moi",
    "login_oidc": "Se connecter avec OIDC",
    "basic_http_login": "Utiliser l'authentification HTTP basique",

    // Change Password keys:
    "change_password_title": "Changer le mot de passe",
    "old_password": "Ancien mot de passe",
    "new_password": "Nouveau mot de passe",
    "confirm_new_password": "Confirmer le nouveau mot de passe",

    // Add User keys:
    "create_new_user_title": "Créer un nouvel utilisateur",
    "username": "Nom d'utilisateur :",
    "password": "Mot de passe :",
    "enter_password": "Mot de passe",
    "preparing_download": "Préparation de votre téléchargement...",
    "download_file": "Télécharger le fichier",
    "confirm_or_change_filename": "Confirmez ou modifiez le nom du fichier à télécharger :",
    "filename": "Nom du fichier",
    "cancel": "Annuler",
    "download": "Télécharger",
    "grant_admin": "Accorder l'accès administrateur",
    "save_user": "Enregistrer l'utilisateur",

    // Remove User keys:
    "remove_user_title": "Supprimer un utilisateur",
    "select_user_remove": "Sélectionnez un utilisateur à supprimer :",
    "delete_user": "Supprimer l'utilisateur",

    // Rename File keys:
    "rename_file_title": "Renommer le fichier",
    "rename_file_placeholder": "Entrez le nouveau nom du fichier",

    // Folder Share
    "share_folder": "Partager le dossier",
    "allow_uploads": "Autoriser les téléchargements",
    "share_link_generated": "Lien de partage généré",
    "error_generating_share_link": "Erreur lors de la génération du lien de partage",

    // Folder
    "folder_share": "Partager le dossier",

    // Custom Confirm Modal keys:
    "yes": "Oui",
    "no": "Non",
    "unsaved_changes_confirm": "Vous avez des modifications non enregistrées. Êtes-vous sûr de vouloir fermer sans enregistrer ?",
    "delete": "Supprimer",
    "download": "Télécharger",
    "upload": "Téléverser",
    "copy": "Copier",
    "extract": "Extraire",
    "user": "Utilisateur :",
    "unknown_error": "Erreur inconnue",
    "link_copied": "Lien copié dans le presse-papiers",
    "minutes": "minutes",
    "hours": "heures",
    "days": "jours",
    "weeks": "semaines",
    "months": "mois",
    "seconds": "secondes",

    // Dark Mode Toggle
    "dark_mode_toggle": "Mode sombre",
    "light_mode_toggle": "Mode clair",

    // NEW KEYS ADDED FOR ADMIN, USER PANELS, AND TOTP MODALS:
    "admin_panel": "Panneau d'administration",
    "user_panel": "Panneau utilisateur",
    "totp_settings": "Paramètres TOTP",
    "enable_totp": "Activer TOTP",
    "language": "Langue",
    "select_language": "Sélectionnez la langue",
    "english": "Anglais",
    "spanish": "Espagnol",
    "french": "Français",
    "german": "Allemand",
    "use_totp_code_instead": "Utiliser le code TOTP à la place",
    "submit_recovery_code": "Soumettre le code de récupération",
    "please_enter_recovery_code": "Veuillez entrer votre code de récupération.",
    "recovery_code_verification_failed": "La vérification du code de récupération a échoué",
    "error_verifying_recovery_code": "Erreur lors de la vérification du code de récupération",
    "totp_verification_failed": "La vérification TOTP a échoué",
    "error_verifying_totp_code": "Erreur lors de la vérification du code TOTP",
    "totp_setup": "Configuration TOTP",
    "scan_qr_code": "Scannez ce QR code avec votre application d'authentification.",
    "enter_totp_confirmation": "Entrez le code à 6 chiffres de votre application pour confirmer la configuration :",
    "confirm": "Confirmer",
    "please_enter_valid_code": "Veuillez entrer un code valide à 6 chiffres.",
    "totp_enabled_successfully": "TOTP activé avec succès.",
    "error_generating_recovery_code": "Erreur lors de la génération du code de récupération",
    "error_loading_qr_code": "Erreur lors du chargement du QR code.",
    "error_disabling_totp_setting": "Erreur lors de la désactivation des paramètres TOTP",
    "user_management": "Gestion des utilisateurs",
    "add_user": "Ajouter un utilisateur",
    "remove_user": "Supprimer un utilisateur",
    "user_permissions": "Permissions des utilisateurs",
    "oidc_configuration": "Configuration OIDC",
    "oidc_provider_url": "URL du fournisseur OIDC",
    "oidc_client_id": "ID du client OIDC",
    "oidc_client_secret": "Secret du client OIDC",
    "oidc_redirect_uri": "URI de redirection OIDC",
    "global_totp_settings": "Paramètres globaux TOTP",
    "global_otpauth_url": "URL globale OTPAuth",
    "login_options": "Options de connexion",
    "disable_login_form": "Désactiver le formulaire de connexion",
    "disable_basic_http_auth": "Désactiver l'authentification HTTP basique",
    "disable_oidc_login": "Désactiver la connexion OIDC",
    "save_settings": "Enregistrer les paramètres",
    "at_least_one_login_method": "Au moins une méthode de connexion doit rester activée.",
    "settings_updated_successfully": "Paramètres mis à jour avec succès.",
    "error_updating_settings": "Erreur lors de la mise à jour des paramètres",
    "user_permissions_updated_successfully": "Permissions des utilisateurs mises à jour avec succès.",
    "error_updating_permissions": "Erreur lors de la mise à jour des permissions",
    "no_users_found": "Aucun utilisateur trouvé.",
    "user_folder_only": "Uniquement le dossier utilisateur",
    "read_only": "Lecture seule",
    "disable_upload": "Désactiver le téléchargement",
    "error_loading_users": "Erreur lors du chargement des utilisateurs",
    "save_permissions": "Enregistrer les permissions",
    "your_recovery_code": "Votre code de récupération",
    "please_save_recovery_code": "Veuillez sauvegarder ce code en toute sécurité. Il ne sera plus affiché et ne pourra être utilisé qu'une seule fois.",
    "ok": "OK",
    "columns": "Colonnes"
  },
  de: {
    "please_log_in_to_continue": "Bitte melden Sie sich an, um fortzufahren.",
    "no_files_selected": "Keine Dateien ausgewählt.",
    "confirm_delete_files": "Sind Sie sicher, dass Sie {count} ausgewählte Datei(en) löschen möchten?",
    "element_not_found": "Element mit der ID \"{id}\" wurde nicht gefunden.",
    "search_placeholder": "Dateien, Tags und Uploader suchen...",
    "search_placeholder_advanced": "Erweiterte Suche: Dateien, Tags, Uploader & Inhalt...",
    "basic_search_tooltip": "Einfache Suche: Nach Dateiname, Tags und Uploader suchen.",
    "advanced_search_tooltip": "Erweiterte Suche: Beinhaltet Dateiinhalte zusätzlich zum Dateinamen, Tags und Uploader.",
    "file_name": "Dateiname",
    "date_modified": "Änderungsdatum",
    "upload_date": "Hochladedatum",
    "file_size": "Dateigröße",
    "uploader": "Uploader",
    "enter_totp_code": "Geben Sie den TOTP-Code ein",
    "use_recovery_code_instead": "Verwenden Sie stattdessen den Wiederherstellungscode",
    "enter_recovery_code": "Geben Sie den Wiederherstellungscode ein",
    "editing": "Bearbeitung",
    "decrease_font": "A-",
    "increase_font": "A+",
    "save": "Speichern",
    "close": "Schließen",
    "no_files_found": "Keine Dateien gefunden.",
    "switch_to_table_view": "Zur Tabellenansicht wechseln",
    "switch_to_gallery_view": "Zur Galerieansicht wechseln",
    "share_file": "Datei teilen",
    "set_expiration": "Ablauf festlegen:",
    "password_optional": "Passwort (optional):",
    "generate_share_link": "Freigabelink generieren",
    "shareable_link": "Freigabelink:",
    "copy_link": "Link kopieren",
    "tag_file": "Datei taggen",
    "tag_name": "Tagname:",
    "tag_color": "Tagfarbe:",
    "save_tag": "Tag speichern",
    "light_mode": "Heller Modus",
    "dark_mode": "Dunkler Modus",
    "upload_instruction": "Ziehen Sie Dateien/Ordner hierher oder klicken Sie auf 'Dateien auswählen'",
    "no_files_selected_default": "Keine Dateien ausgewählt",
    "choose_files": "Dateien auswählen",
    "delete_selected": "Ausgewählte löschen",
    "copy_selected": "Ausgewählte kopieren",
    "move_selected": "Ausgewählte verschieben",
    "tag_selected": "Ausgewählte taggen",
    "download_zip": "Zip herunterladen",
    "extract_zip": "Zip entpacken",
    "preview": "Vorschau",
    "edit": "Bearbeiten",
    "rename": "Umbenennen",
    "trash_empty": "Papierkorb ist leer.",
    "no_trash_selected": "Keine Papierkorbeinträge zur Wiederherstellung ausgewählt.",

    // Additional keys for HTML translations:
    "title": "FileRise",
    "header_title": "FileRise",
    "logout": "Abmelden",
    "change_password": "Passwort ändern",
    "restore_text": "Wiederherstellen oder",
    "delete_text": "Papierkorbeinträge löschen",
    "restore_selected": "Ausgewählte wiederherstellen",
    "restore_all": "Alle wiederherstellen",
    "delete_selected_trash": "Ausgewählte löschen",
    "delete_all": "Alle löschen",
    "upload_header": "Dateien/Ordner hochladen",

    // Folder Management keys:
    "folder_navigation": "Ordnernavigation & Verwaltung",
    "create_folder": "Ordner erstellen",
    "create_folder_title": "Ordner erstellen",
    "enter_folder_name": "Geben Sie den Ordnernamen ein",
    "cancel": "Abbrechen",
    "create": "Erstellen",
    "rename_folder": "Ordner umbenennen",
    "rename_folder_title": "Ordner umbenennen",
    "rename_folder_placeholder": "Neuen Ordnernamen eingeben",
    "delete_folder": "Ordner löschen",
    "delete_folder_title": "Ordner löschen",
    "delete_folder_message": "Sind Sie sicher, dass Sie diesen Ordner löschen möchten?",
    "folder_help": "Ordnerhilfe",
    "folder_help_item_1": "Klicken Sie auf einen Ordner im Baum, um dessen Dateien anzuzeigen.",
    "folder_help_item_2": "Verwenden Sie [-] zum Einklappen und [+] zum Ausklappen der Ordner.",
    "folder_help_item_3": "Wählen Sie einen Ordner aus und klicken Sie auf \"Ordner erstellen\", um einen Unterordner hinzuzufügen.",
    "folder_help_item_4": "Um einen Ordner umzubenennen oder zu löschen, wählen Sie ihn aus und klicken Sie auf den entsprechenden Button.",

    // File List keys:
    "actions": "Aktionen",
    "file_list_title": "Dateien in (Root)",
    "files_in": "Dateien in",
    "delete_files": "Dateien löschen",
    "delete_selected_files_title": "Ausgewählte Dateien löschen",
    "delete_files_message": "Sind Sie sicher, dass Sie die ausgewählten Dateien löschen möchten?",
    "copy_files": "Dateien kopieren",
    "copy_files_title": "Ausgewählte Dateien kopieren",
    "copy_files_message": "Wählen Sie einen Zielordner, um die ausgewählten Dateien zu kopieren:",
    "move_files": "Dateien verschieben",
    "move_files_title": "Ausgewählte Dateien verschieben",
    "move_files_message": "Wählen Sie einen Zielordner, um die ausgewählten Dateien zu verschieben:",
    "move": "Verschieben",
    "extract_zip_button": "Zip entpacken",
    "download_zip_title": "Ausgewählte Dateien als Zip herunterladen",
    "download_zip_prompt": "Geben Sie einen Namen für die Zip-Datei ein:",
    "zip_placeholder": "files.zip",
    "share": "Teilen",
    "total_files": "Gesamtanzahl",
    "total_size": "Gesamtgröße",
    "prev": "Zurück",
    "next": "Weiter",
    "page": "Seite",
    "of": "von",

    // Login Form keys:
    "login": "Anmelden",
    "remember_me": "Angemeldet bleiben",
    "login_oidc": "Mit OIDC anmelden",
    "basic_http_login": "HTTP-Basisauthentifizierung verwenden",

    // Change Password keys:
    "change_password_title": "Passwort ändern",
    "old_password": "Altes Passwort",
    "new_password": "Neues Passwort",
    "confirm_new_password": "Neues Passwort bestätigen",

    // Add User keys:
    "create_new_user_title": "Neuen Benutzer erstellen",
    "username": "Benutzername:",
    "password": "Passwort:",
    "enter_password": "Passwort",
    "preparing_download": "Bereite Ihren Download vor...",
    "download_file": "Datei herunterladen",
    "confirm_or_change_filename": "Bestätigen oder ändern Sie den Dateinamen zum Download:",
    "filename": "Dateiname",
    "cancel": "Abbrechen",
    "download": "Herunterladen",
    "grant_admin": "Admin-Rechte vergeben",
    "save_user": "Benutzer speichern",

    // Remove User keys:
    "remove_user_title": "Benutzer entfernen",
    "select_user_remove": "Wählen Sie einen Benutzer zum Entfernen aus:",
    "delete_user": "Benutzer löschen",

    // Rename File keys:
    "rename_file_title": "Datei umbenennen",
    "rename_file_placeholder": "Geben Sie den neuen Dateinamen ein",

    // Folder Share
    "share_folder": "Ordner teilen",
    "allow_uploads": "Uploads erlauben",
    "share_link_generated": "Freigabelink generiert",
    "error_generating_share_link": "Fehler beim Generieren des Freigabelinks",

    // Folder
    "folder_share": "Ordner teilen",

    // Custom Confirm Modal keys:
    "yes": "Ja",
    "no": "Nein",
    "unsaved_changes_confirm": "Sie haben ungespeicherte Änderungen. Sind Sie sicher, dass Sie schließen möchten, ohne zu speichern?",
    "delete": "Löschen",
    "download": "Herunterladen",
    "upload": "Hochladen",
    "copy": "Kopieren",
    "extract": "Entpacken",
    "user": "Benutzer:",
    "unknown_error": "Unbekannter Fehler",
    "link_copied": "Link in die Zwischenablage kopiert",
    "minutes": "Minuten",
    "hours": "Stunden",
    "days": "Tage",
    "weeks": "Wochen",
    "months": "Monate",
    "seconds": "Sekunden",

    // Dark Mode Toggle
    "dark_mode_toggle": "Dunkler Modus",
    "light_mode_toggle": "Heller Modus",

    // NEW KEYS ADDED FOR ADMIN, USER PANELS, AND TOTP MODALS:
    "admin_panel": "Administrationsbereich",
    "user_panel": "Benutzerbereich",
    "trash_restore_delete": "Papierkorb wiederherstellen/löschen",
    "totp_settings": "TOTP-Einstellungen",
    "enable_totp": "TOTP aktivieren",
    "language": "Sprache",
    "select_language": "Sprache auswählen",
    "english": "Englisch",
    "spanish": "Spanisch",
    "french": "Französisch",
    "german": "Deutsch",
    "use_totp_code_instead": "Stattdessen TOTP-Code verwenden",
    "submit_recovery_code": "Wiederherstellungscode absenden",
    "please_enter_recovery_code": "Bitte geben Sie Ihren Wiederherstellungscode ein.",
    "recovery_code_verification_failed": "Überprüfung des Wiederherstellungscodes fehlgeschlagen",
    "error_verifying_recovery_code": "Fehler bei der Überprüfung des Wiederherstellungscodes",
    "totp_verification_failed": "TOTP-Überprüfung fehlgeschlagen",
    "error_verifying_totp_code": "Fehler bei der Überprüfung des TOTP-Codes",
    "totp_setup": "TOTP-Einrichtung",
    "scan_qr_code": "Scannen Sie diesen QR-Code mit Ihrer Authenticator-App.",
    "enter_totp_confirmation": "Geben Sie den 6-stelligen Code aus Ihrer App zur Bestätigung ein:",
    "confirm": "Bestätigen",
    "please_enter_valid_code": "Bitte geben Sie einen gültigen 6-stelligen Code ein.",
    "totp_enabled_successfully": "TOTP wurde erfolgreich aktiviert.",
    "error_generating_recovery_code": "Fehler beim Generieren des Wiederherstellungscodes",
    "error_loading_qr_code": "Fehler beim Laden des QR-Codes.",
    "error_disabling_totp_setting": "Fehler beim Deaktivieren der TOTP-Einstellungen",
    "user_management": "Benutzerverwaltung",
    "add_user": "Benutzer hinzufügen",
    "remove_user": "Benutzer entfernen",
    "user_permissions": "Benutzerberechtigungen",
    "oidc_configuration": "OIDC-Konfiguration",
    "oidc_provider_url": "OIDC-Anbieter-URL",
    "oidc_client_id": "OIDC-Client-ID",
    "oidc_client_secret": "OIDC-Client-Geheimnis",
    "oidc_redirect_uri": "OIDC-Umleitungs-URI",
    "global_totp_settings": "Globale TOTP-Einstellungen",
    "global_otpauth_url": "Globale OTPAuth-URL",
    "login_options": "Anmeldeoptionen",
    "disable_login_form": "Anmeldeformular deaktivieren",
    "disable_basic_http_auth": "HTTP-Basisauthentifizierung deaktivieren",
    "disable_oidc_login": "OIDC-Anmeldung deaktivieren",
    "save_settings": "Einstellungen speichern",
    "at_least_one_login_method": "Mindestens eine Anmeldemethode muss aktiviert bleiben.",
    "settings_updated_successfully": "Einstellungen wurden erfolgreich aktualisiert.",
    "error_updating_settings": "Fehler beim Aktualisieren der Einstellungen",
    "user_permissions_updated_successfully": "Benutzerberechtigungen wurden erfolgreich aktualisiert.",
    "error_updating_permissions": "Fehler beim Aktualisieren der Berechtigungen",
    "no_users_found": "Keine Benutzer gefunden.",
    "user_folder_only": "Nur Benutzerordner",
    "read_only": "Nur Lesen",
    "disable_upload": "Upload deaktivieren",
    "error_loading_users": "Fehler beim Laden der Benutzer",
    "save_permissions": "Berechtigungen speichern",
    "your_recovery_code": "Ihr Wiederherstellungscode",
    "please_save_recovery_code": "Bitte speichern Sie diesen Code sicher. Er wird nicht erneut angezeigt und kann nur einmal verwendet werden.",
    "ok": "OK",
    "show": "Zeige",
    "items_per_page": "elemente pro seite",
    "columns": "Spalten"
  }
};

let currentLocale = 'en';

export function setLocale(locale) {
  currentLocale = locale;
}

export function t(key, placeholders) {
  const localeTranslations = translations[currentLocale] || {};
  let translation = localeTranslations[key] || key;
  if (placeholders) {
    Object.keys(placeholders).forEach(ph => {
      translation = translation.replace(`{${ph}}`, placeholders[ph]);
    });
  }
  return translation;
}

export function applyTranslations() {
  document.querySelectorAll('[data-i18n-key]').forEach(el => {
    el.innerText = t(el.getAttribute('data-i18n-key'));
  });
  document.querySelectorAll('[data-i18n-placeholder]').forEach(el => {
    el.setAttribute('placeholder', t(el.getAttribute('data-i18n-placeholder')));
  });
  document.querySelectorAll('[data-i18n-title]').forEach(el => {
    el.setAttribute('title', t(el.getAttribute('data-i18n-title')));
  });
}